Skip to content

Add @cratis/eslint-plugin-components#95

Merged
einari merged 5 commits into
mainfrom
feature/shareable-eslint
Jun 4, 2026
Merged

Add @cratis/eslint-plugin-components#95
einari merged 5 commits into
mainfrom
feature/shareable-eslint

Conversation

@woksin

@woksin woksin commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Added

  • @cratis/eslint-plugin-components: ESLint rules for projects that consume Cratis Components, designed to compose on top of @cratis/eslint-config.
    • no-root-barrel-import (rule) — disallows importing from the @cratis/components root barrel. Use a subpath export (@cratis/components/CommandDialog, @cratis/components/DataPage, @cratis/components/Toolbar, …); the root pulls the whole optional-peer-heavy surface and hides intent. Covers import and re-export … from. Configurable package name and allow-list.
    • no-primereact-dialog (rule) — disallows importing Dialog from primereact/dialog. Use CommandDialog from @cratis/components/CommandDialog, or Dialog from @cratis/components/Dialogs — the wrappers add Arc command binding, overlay/focus fixes, and theming.

Changed

  • Add the ESLint workspace to the repo workspaces.

Notes

  • Named per the ESLint scoped-plugin convention (@scope/eslint-plugin-*). The plugin namespace is @cratis/components, so rule IDs read @cratis/components/no-root-barrel-import.
  • Ships as raw ESM (no build step), declares only eslint as a peer dependency, and exposes meta.version plus per-rule docs URLs. It owns these rules because Components owns its subpath export surface and the dialog wrappers.

🤖 Generated with Claude Code

Introduce @cratis/components.eslint, ESLint rules for projects that consume
Cratis Components, to compose on top of @cratis/eslint-config:

- no-root-barrel-import: require importing from a @cratis/components subpath
  (e.g. @cratis/components/CommandDialog) instead of the package root barrel.
- no-primereact-dialog: forbid importing primereact/dialog; use the Cratis
  dialog wrappers (CommandDialog, Dialogs) which add Arc binding and theming.

Register the ESLint workspace in the repo workspaces.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@woksin woksin added the minor label Jun 4, 2026
woksin and others added 2 commits June 4, 2026 11:14
Expose name + version on the plugin meta (cache keys, --print-config) and docs
URLs on both rules so IDEs render a clickable link.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Follow the ESLint scoped-plugin naming convention (@scope/eslint-plugin-*). The
plugin namespace stays @cratis/components, so rule IDs are unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@woksin woksin changed the title Add @cratis/components.eslint Add @cratis/eslint-plugin-components Jun 4, 2026
@woksin woksin requested a review from einari June 4, 2026 13:38
woksin and others added 2 commits June 4, 2026 15:44
Make the default export the plugin object itself (meta + rules + self-referencing
configs), per the ESLint flat-config plugin convention. Name the config block.
Fold recommended.js into index.js.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Previously the first failed 'npm publish' called process.exit(1), aborting the
release and stranding every workspace after it. A brand-new package whose npm
trusted publisher isn't configured yet would therefore also block the existing
packages from releasing. Collect publish failures, keep publishing the rest, and
exit non-zero at the end with a summary. Build/test tasks stay fail-fast.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@woksin

woksin commented Jun 4, 2026

Copy link
Copy Markdown
Contributor Author

⚠️ One-time first-publish bootstrap (before this releases cleanly)

This PR adds a brand-new npm package@cratis/eslint-plugin-components. The Publish workflow uses npm trusted publishing (OIDC) (it strips the auth token), which requires a trusted-publisher relationship that must already exist on the package. That can't be configured before the package exists, so the package's first publish over OIDC will fail.

One-time bootstrap (do before merge, or after — the companion resilience commit means an un-bootstrapped package no longer blocks the others):

  • Initial token-based publish to create the package, authenticated to npm with publish rights to @cratis:
    cd ESLint
    npm publish --access public
    (or run with a granular NODE_AUTH_TOKEN). publishConfig.access: public is already set.
  • Configure the trusted publisher: npmjs.com → @cratis/eslint-plugin-componentsSettings → Trusted Publisher → repository Cratis/Components, workflow .github/workflows/publish.yml.
  • Verify the next Publish run publishes over OIDC with no token.

Heads-up — co-versioning: publish-version sets every workspace to the repo release version, so on the first automated release this package jumps to ~2.x (matching @cratis/components), not 0.x/1.0.0. Starting it independently would need a release-pipeline change.

🤖 Generated with Claude Code

@woksin

woksin commented Jun 4, 2026

Copy link
Copy Markdown
Contributor Author

@einari — two one-time steps before merging this. This is 1 of 3 coordinated PRs: Fundamentals Cratis/Fundamentals#1072, Arc Cratis/Arc#2273, Components #95.

1. Bootstrap @cratis/eslint-plugin-components on npm (one-time)

The Publish workflow uses OIDC trusted publishing, which can't create a package that doesn't exist yet — so the first publish has to be done by hand. From a checkout of this branch, authenticated to npm with publish rights to @cratis:

cd ESLint
npm publish --access public

Then on npmjs.com → @cratis/eslint-plugin-componentsSettings → Trusted Publisher: repository Cratis/Components, workflow .github/workflows/publish.yml. (publishConfig.access: public is already set; the throwaway 0.0.0 gets superseded by the real version on the first automated release.)

2. Merge with the minor label (already applied)

Merging triggers the Publish workflow, which co-versions and releases every workspace over OIDC — including the now-bootstrapped package.

Order: bootstrap → merge for a fully-green first release. Merging before bootstrapping is safe too — the resilience commit means this new package failing to publish no longer blocks @cratis/components or the other workspaces; it just won't publish until bootstrapped.

Versioning note: co-versioning makes this plugin debut at ~2.x (the repo version), not 1.0.0. Say the word if you want it versioned independently and we'll adjust the pipeline first.

🤖 Generated with Claude Code

@einari einari merged commit 02b7eed into main Jun 4, 2026
4 checks passed
@einari einari deleted the feature/shareable-eslint branch June 4, 2026 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants